<?php

declare(strict_types=1);

namespace App\Model;


/**
 * @property int $id ID
 * @property int $userid 用户ID
 * @property int $expert_id 专家称号ID
 * @property string $expert_desc 专家称号
 * @property int $fans_count 粉丝数量
 * @property int $fans_count_rank 粉丝排行x
 * @property string $introduce 自我介绍
 * @property string $recent_win_rate 近期胜率
 * @property int $recent_win_rate_rank 近期胜率排行
 * @property string $recent_payback_rate 近期回报率
 * @property int $recent_payback_rate_rank 近期回报率排行
 * @property int $recent_red_num 近期连红
 * @property int $recent_red_num_rank 近期连红排行
 * @property int $day_win 7天赢
 * @property int $day_walk 7天走
 * @property int $day_lose 7天输
 * @property int $count_win 近10场赢
 * @property int $count_walk 近10场走
 * @property int $count_lose 近10场输
 * @property int $rank_fans_count 粉丝排行
 * @property int $rank_red_count 连红排行
 * @property int $rand_hit_count 命中排行
 * @property int $rank_payback_count 回报排行
 * @property-read null|User $user 
 */
class UserModelExpert extends Model
{
    /**
     * The table associated with the model.
     */
    protected ?string $table = 'user_model_expert';

    /**
     * The attributes that are mass assignable.
     */
    protected array $fillable = ['id', 'userid', 'expert_id', 'expert_desc', 'fans_count', 'fans_count_rank', 'introduce', 'recent_win_rate', 'recent_win_rate_rank', 'recent_payback_rate', 'recent_payback_rate_rank', 'recent_red_num', 'recent_red_num_rank', 'day_win', 'day_walk', 'day_lose', 'count_win', 'count_walk', 'count_lose', 'rank_fans_count', 'rank_red_count', 'rand_hit_count', 'rank_payback_count'];

    /**
     * The attributes that should be cast to native types.
     */
    protected array $casts = ['id' => 'integer', 'userid' => 'integer', 'expert_id' => 'integer', 'fans_count' => 'integer', 'fans_count_rank' => 'integer', 'recent_win_rate_rank' => 'integer', 'recent_payback_rate_rank' => 'integer', 'recent_red_num' => 'integer', 'recent_red_num_rank' => 'integer', 'day_win' => 'integer', 'day_walk' => 'integer', 'day_lose' => 'integer', 'count_win' => 'integer', 'count_walk' => 'integer', 'count_lose' => 'integer', 'rank_fans_count' => 'integer', 'rank_red_count' => 'integer', 'rand_hit_count' => 'integer', 'rank_payback_count' => 'integer'];

    public function user(){
        return $this->belongsTo(User::class, 'userid', 'id');
    }
}
